<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form nz-form class="search-form" [formGroup]="searchForm" (keydown.enter)="$event.preventDefault();onSearch()" nzLayout="inline">
            <nz-form-item>
        <nz-form-label nzFor="buildingName">楼栋名称</nz-form-label>
        <nz-form-control>
          <nz-input-group nzSearch [nzAddOnAfter]="buildingNameSuffixIconButton">
            <input nz-input formControlName="buildingName" placeholder="请选择楼栋名称" readonly />
          </nz-input-group>
          <ng-template #buildingNameSuffixIconButton>
            <button nz-button nzType="primary" nzSearch (click)="findBuilding()"><nz-icon nzType="search" /></button>
          </ng-template>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label nzFor="roomNumber">单元房号</nz-form-label>
        <nz-form-control>
          <nz-input-group nzSearch [nzAddOnAfter]="roomNumberSuffixIconButton">
            <input nz-input formControlName="roomNumber" placeholder="请选择单元房号" readonly />
          </nz-input-group>
          <ng-template #roomNumberSuffixIconButton>
            <button nz-button nzType="primary" nzSearch (click)="findRoom()"><nz-icon nzType="search" /></button>
          </ng-template>
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label nzFor="chargeType">收费类型</nz-form-label>
        <nz-form-control>
          <nz-select formControlName="chargeType" class="custom-select-width">
            <nz-option nzLabel="物业费" [nzValue]="10"></nz-option>
            <nz-option nzLabel="水费" [nzValue]="20"></nz-option>
            <nz-option nzLabel="电费" [nzValue]="30"></nz-option>
            <nz-option nzLabel="煤气费" [nzValue]="40"></nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
<nz-form-item>
        <nz-form-label nzFor="billingCycle">收费周期类型</nz-form-label>
        <nz-form-control>
          <input nz-input formControlName="billingCycle" placeholder="请输入收费周期类型" />
        </nz-form-control>
      </nz-form-item>
      <nz-form-item>
        <nz-form-label nzFor="paymentStatus">支付状态</nz-form-label>
        <nz-form-control>
          <nz-select formControlName="paymentStatus" class="custom-select-width">
            <nz-option nzLabel="未支付" [nzValue]="10"></nz-option>
            <nz-option nzLabel="已支付" [nzValue]="20"></nz-option>
            <nz-option nzLabel="已作废" [nzValue]="90"></nz-option>
          </nz-select>
        </nz-form-control>
      </nz-form-item>
      <button nz-button type="button" nzType="primary" [nzLoading]="searchLoading" (click)="onSearch()">查询</button>
      <button nz-button type="button" class="margin-button" (click)="onReset()">重置</button>
    </form>
    <nz-table #basicTable [nzData]="listOfData" [nzTotal]="total" [nzLoading]="searchLoading" nzSize="small">
      <thead>
        <tr>
          <th>楼栋名称</th>
          <th>单元房号</th>
          <th>收费类型</th>
          <th>收费周期类型</th>
          <th>收费周期开始时间</th>
          <th>收费周期结束时间</th>
          <th>金额</th>
          <th>滞纳金金额</th>
          <th>应付截止日期</th>
          <th>实际支付日期</th>
          <th>支付状态</th>
        </tr>
      </thead>
      <tbody>
        <tr *ngFor="let data of basicTable.data" (dblclick)="onRowDblClick(data, $event)">
          <td>{{data.buildingName}}</td>
          <td>{{data.roomNumber}}</td>
          <td>
            <ng-container *ngIf="data.chargeType === 10">物业费</ng-container>
            <ng-container *ngIf="data.chargeType === 20">水费</ng-container>
            <ng-container *ngIf="data.chargeType === 30">电费</ng-container>
            <ng-container *ngIf="data.chargeType === 40">煤气费</ng-container>
          </td>
          <td>{{data.billingCycle}}</td>
          <td>{{data.billingStartDate}}</td>
          <td>{{data.billingEndDate}}</td>
          <td>{{data.amount}}</td>
          <td>{{data.lateFee}}</td>
          <td>{{data.dueDate}}</td>
          <td>{{data.paymentDate}}</td>
          <td>
            <ng-container *ngIf="data.paymentStatus === 10">未支付</ng-container>
            <ng-container *ngIf="data.paymentStatus === 20">已支付</ng-container>
            <ng-container *ngIf="data.paymentStatus === 90">已作废</ng-container>
          </td>
        </tr>
      </tbody>
    </nz-table>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<building-selector (buildingSelectedEvent)="handleBuildingSelectedEvent($event)"></building-selector>
<room-selector (roomSelectedEvent)="handleRoomSelectedEvent($event)"></room-selector>
